﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using SnailGame.Utility.DataAccess;
using System.Configuration;
using Com.Crc.PoJo.Model.Resource;

namespace Com.Crc
{
    public class InitControlManagerDAL
    {
        DataBroker broker = new DataBroker();

        /// <summary>
        /// 查询局点信息
        /// </summary>
        /// <returns></returns>
        public DataTable QueryBranchInfo()
        {
            string strSql = @" SELECT N_ID,S_NAME FROM TT_RESOURCE_SUBSTATION WHERE S_STATE='1' ";
            return broker.ExecuteQueryForOleDB(strSql, ConfigurationManager.ConnectionStrings["CRCAppConn"].ToString());
        }

        /// <summary>
        /// 查询小区信息
        /// </summary>
        /// <returns></returns>
        public DataTable QuerySubDistrictInfo()
        {
            string strSql = @" SELECT N_ID,S_NAME FROM TT_RESOURCE_SUBDISTRICT WHERE S_STATE='1' ";
            return broker.ExecuteQueryForOleDB(strSql, ConfigurationManager.ConnectionStrings["CRCAppConn"].ToString());
        }

        /// <summary>
        /// 查询字典表信息
        /// </summary>
        /// <returns></returns>
        public DataTable QueryCommonDicInfo(Dictionary.COMMON_DIC_TYPE intType)
        {
            string strSql = @" SELECT N_ID,S_NAME FROM TT_RESOURCE_DICTIONARY WHERE S_STATE='1' AND S_TYPE = " + (int)intType + " ORDER BY S_NAME ";
            return broker.ExecuteQueryForOleDB(strSql, ConfigurationManager.ConnectionStrings["CRCAppConn"].ToString());
        }
    }
}
